home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 34.zip / BS1 part 34 / Aztec C 5.0a disk 1.adf / include / stdio.h < prev    next >
C/C++ Source or Header  |  1989-08-05  |  4KB  |  133 lines

  1. /* Copyright 1989 Manx Software Systems, Inc. All rights reserved */
  2.  
  3. #ifndef __STDIO_H
  4. #define    __STDIO_H
  5.  
  6. #include <stdarg.h>
  7.  
  8. # ifndef _SIZE_T
  9. # define _SIZE_T
  10.   typedef unsigned long size_t;
  11. # endif
  12.  
  13. #ifndef NULL
  14. #define NULL ((void *)0)
  15. #endif
  16.  
  17. #define BUFSIZ 1024
  18.  
  19. #define EOF (-1)
  20.  
  21. #define L_tmpnam 40
  22. #define FOPEN_MAX 20    /* must agree with FCntl.h */
  23. #define FILENAME_MAX 126
  24. #define TMP_MAX 25
  25.  
  26. #define SEEK_SET 0    /* from beginning of file */
  27. #define SEEK_CUR 1    /* from current position */
  28. #define SEEK_END 2    /* from end of file */
  29.  
  30. #define stdin (&_iob[0])
  31. #define stdout (&_iob[1])
  32. #define stderr (&_iob[2])
  33.  
  34. typedef long int fpos_t;
  35.  
  36. typedef struct __stdio {
  37.     unsigned char *_bp;            /* current position in buffer */
  38.     unsigned char *_bend;        /* last character in buffer + 1 */
  39.     unsigned char *_buff;        /* address of buffer */
  40.     unsigned short _flags;        /* open mode, etc. */
  41.     char _unit;                    /* fd returned by open */
  42.     unsigned char _bytbuf;        /* single byte buffer for unbuffered streams */
  43.     size_t _buflen;                /* length of buffer */
  44.     unsigned short _tmpnum;        /* name of file for temporaries */
  45. } FILE;
  46. extern FILE _iob[];
  47.  
  48. #define _IOMYBUF    0x0001    /* malloced buffer */
  49. #define _IOEOF        0x0002    /* end-of-file encountered */
  50. #define _IOERR        0x0004    /* error occurred */
  51. #define _IOSTRNG    0x0008    /* special string stream */
  52. #define _IOBIN        0x0010    /* file is binary ("b") */
  53. #define _IOLBF        0x0020    /* line buffered */
  54. #define _IOFBF        0x0040    /* fully buffered */
  55. #define _IONBF        0x0080    /* completely unbuffered */
  56. #define _IOCON        0x0100    /* console device */
  57. #define _IOR        0x0200    /* stream opened in read mode */
  58. #define _IOW        0x0400    /* stream opened in write mode */
  59. #define _IORW        0x0800    /* stream opened in update mode */
  60. #define _IOUNG        0x1000    /* ungetc was called */
  61. #define _IOSYNC     0x2000    /* MPW compatibility */
  62. #define _IODIRTY    0x4000    /* buffer has been written */
  63.  
  64. int remove(const char *_filename);
  65. int rename(const char *_old, const char *_new);
  66. FILE *tmpfile(void);
  67. char *tmpnam(char *_s);
  68. int fclose(FILE *_stream);
  69. int fflush(FILE *_stream);
  70. FILE *fopen(const char *_filename, const char *_mode);
  71. FILE *freopen(const char *_filename, const char *_mode, FILE *_stream);
  72. void setbuf(FILE *_stream, char *_buf);
  73. int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size);
  74. int fprintf(FILE *_stream, const char *_format, ...);
  75. int fscanf(FILE *_stream, const char *_format, ...);
  76. int printf(const char *_format, ...);
  77. int scanf(const char *_format, ...);
  78. int sprintf(char *_s, const char *_format, ...);
  79. int sscanf(const char *_s, const char *_format, ...);
  80. int vfprintf(FILE *_stream, const char *_format, va_list _arg);
  81. int vprintf(const char *_format, va_list _arg);
  82. int vsprintf(char *_s, const char *_format, va_list _arg);
  83. int fgetc(FILE *_stream);
  84. char *fgets(char *_s, int _n, FILE *_stream);
  85. int fputc(int _c, FILE *_stream);
  86. int fputs(const char *_s, FILE *_stream);
  87. int getc(FILE *_stream);
  88. int getchar(void);
  89. char *gets(char *_s);
  90. int putc(int _c, FILE *_stream);
  91. int putchar(int _c);
  92. int puts(const char *_s);
  93. int ungetc(int _c, FILE *_stream);
  94. size_t fread(void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
  95. size_t fwrite(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
  96. int fgetpos(FILE *_stream, fpos_t *_pos);
  97. int fseek(FILE *_stream, long int _offset, int _whence);
  98. int fsetpos(FILE *_stream, const fpos_t *_pos);
  99. long int ftell(FILE *_stream);
  100. void rewind(FILE *_stream);
  101. void clearerr(FILE *_stream);
  102. int feof(FILE *_stream);
  103. int ferror(FILE *_stream);
  104. void perror(const char *_s);
  105.  
  106. #ifdef __C_MACROS__
  107. #define getc(fp)    ((fp)->_bp < (fp)->_bend ? *(fp)->_bp++ :_filbuf((fp)))
  108. #define putc(c,fp)    ((fp)->_bp < (fp)->_bend ? *(fp)->_bp++ = (c) : \
  109.                                         _flsbuf((fp),(int)(unsigned char)(c)))
  110. #define getchar() getc(stdin)
  111. #define putchar(c) putc((c), stdout)
  112. #define clearerr(fp) ((void)((fp)->_flags &= ~(_IOERR|_IOEOF)))
  113. #define feof(fp) ((fp)->_flags&_IOEOF)
  114. #define ferror(fp) ((fp)->_flags&_IOERR)
  115. #endif
  116.  
  117. #if !__STDC__ /* non ANSI C user-visible stuff */
  118.  
  119. int _flsbuf(FILE *, int);
  120. int _filbuf(FILE *);
  121.  
  122. FILE *fdopen(int, const char *);
  123. #define fileno(fp) ((int)(fp)->_unit)                
  124. #define puterr(c)    (putc((c),stderr))
  125.  
  126. int putw(int _w, FILE *_stream);
  127. int getw(FILE *_stream);
  128.  
  129. #endif /* !__STDC__ */
  130.  
  131. #endif /* _STDIO_H */
  132.  
  133.